package com.lanyam.travel.base.service.impl;


import com.lanyam.travel.base.entity.DictionaryType;
import com.lanyam.travel.base.entity.vo.DictionaryTypeVo;
import com.lanyam.travel.base.dao.DictionaryTypeMapper;
import com.lanyam.travel.base.service.IDictionaryTypeService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;

import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;


@Service
@Transactional
@Slf4j
public class DictionaryTypeServiceImpl implements IDictionaryTypeService {

    @Resource
    private DictionaryTypeMapper dictionaryTypeMapper;

    @Override
    public IPage<DictionaryTypeVo> getPageDictionaryType (Map<String, Object> queryMap, Integer page, Integer rows) {
        Page<DictionaryTypeVo> pageSize = new Page<DictionaryTypeVo>(page, rows);
        Page<DictionaryTypeVo> pageInfo = dictionaryTypeMapper.getPage(pageSize, queryMap);
        return pageInfo;
    }

    @Override
    public void addDictionaryType(DictionaryType dictionaryType) {
        dictionaryTypeMapper.insert(dictionaryType);
    }

    @Override
    public void updateDictionaryType(DictionaryType dictionaryType) {
        dictionaryTypeMapper.updateById(dictionaryType);
    }

    @Override
    public void delById(String id) {
        dictionaryTypeMapper.delById(id);
    }

    @Override
    public List<DictionaryTypeVo> getList() {
        List<DictionaryTypeVo> list = dictionaryTypeMapper.getList();
        return list;
    }
}